{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "9956f3bb",
   "metadata": {},
   "source": [
    "——————————\n",
    "* 时间：2022-09-05   /  week3\n",
    "* 课程：Python语言\n",
    "* 学习记录人：陈泽鑫\n",
    "* 主题：Python入门\n",
    "-------------------\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "0e979a3c",
   "metadata": {},
   "source": [
    "\n",
    "# 本周学习内容\n",
    "\n",
    "> 1.模块\n",
    "\n",
    "> 2.变量\n",
    "\n",
    "> 3.循环变量\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "bac57d1a",
   "metadata": {},
   "source": [
    "## 1.模块 （[标准库](https://docs.python.org/3/library/index.html)）\n",
    ">Python创始人团队为后面使用这门编程语言的人们提供的解决日常生活可能是用到的功能，而制作的可以方便使用的模块"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "4a34bd41",
   "metadata": {},
   "outputs": [],
   "source": [
    "import time"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "5c65cb6e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1662345780.5724533"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 纪元 (1979.1.1)\n",
    "# 时间戳\n",
    "time.time()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "f50c8137",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1662346060.0548935"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "time.time()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "7bd4df1c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "time.struct_time(tm_year=2022, tm_mon=9, tm_mday=5, tm_hour=10, tm_min=47, tm_sec=9, tm_wday=0, tm_yday=248, tm_isdst=0)"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "time.localtime()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "294bdce1",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "time.struct_time(tm_year=2022, tm_mon=9, tm_mday=5, tm_hour=2, tm_min=48, tm_sec=31, tm_wday=0, tm_yday=248, tm_isdst=0)"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "time.gmtime()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "c3a31c91",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'Mon Sep  5 10:54:29 2022'"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "time.asctime(time.localtime())"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "bdd6d314",
   "metadata": {},
   "source": [
    "## 2.开源模块\n",
    ">1. 因为代码开源\n",
    ">2. 集合全领域（全人类）的需求\n",
    ">3. 按照国际标准开放的标准库\n",
    "\n",
    "> [资源地址](http://pypi.org)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "80935609",
   "metadata": {},
   "source": [
    "## 3.模块（自定义模块）\n",
    "> 1. 不愿意开源的有一定知识产权的（开放API租用形式开放）\n",
    "> 2. 自己用的，写的也不怎么好，开源出去丢人的"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "19afad51",
   "metadata": {},
   "source": [
    "# 2. 变量\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "13b8dc0c",
   "metadata": {},
   "outputs": [],
   "source": [
    "网三_01 = \"xiao hong\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "6d0bdfe5",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'xiao hong'"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "网三_01"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "304ff7e1",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2091917043056"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "id(网三_01)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "531c58a2",
   "metadata": {},
   "outputs": [],
   "source": [
    "网三_01_age = 20"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "id": "e1d4ebae",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "20"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "网三_01_age"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "id": "1aa34584",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "180000001 180000001\n"
     ]
    }
   ],
   "source": [
    "# 案例（关于变量）\n",
    "\n",
    "网三_01_ID = \"180000001\"\n",
    "\n",
    "网三_02_ID = 网三_01_ID\n",
    "\n",
    "\n",
    "print(网三_01_ID,网三_02_ID)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "id": "53fe1968",
   "metadata": {},
   "outputs": [],
   "source": [
    "网三_01_ID = \"180000006\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "id": "ac43e171",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "180000006 180000001\n"
     ]
    }
   ],
   "source": [
    "print(网三_01_ID,网三_02_ID)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "4dc218be",
   "metadata": {},
   "source": [
    "# 课后作业\n",
    "\n",
    "* 1. 课本b4项目联系\n",
    "* 2. 思考if 是什么\n",
    "* 3. 思考from 是什么"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "0a661772",
   "metadata": {},
   "outputs": [],
   "source": [
    "from datetime import datetime"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "e17f938e",
   "metadata": {},
   "outputs": [],
   "source": [
    "odds = [ 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, \n",
    "        21, 23, 25, 27, 29, 31, 33, 35, 37, 39, \n",
    "        41, 43, 45, 47, 49, 51, 53, 55, 57, 59 ]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "536b012b",
   "metadata": {},
   "outputs": [],
   "source": [
    "right_this_minute = datetime.today().minute"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "c636fe53",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Not an odd minute.\n"
     ]
    }
   ],
   "source": [
    "if right_this_minute in odds:\n",
    "    print(\"This minute seems a little seems a little odd.\")\n",
    "else:\n",
    "    print(\"Not an odd minute.\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "694cb0b9",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
